/*
 * @Author: xyf
 * @Date: 2021-06-28 15:02:27
 * @LastEditTime: 2021-07-26 18:23:08
 * @LastEditors: xyf
 * @Description: 路由封装
 */

import { createRouter, createWebHashHistory } from 'vue-router'
import layout from '@/components/layout.vue'

const routes = [
  {
    path: '/',
    component: layout,
    redirect: '/home',
    meta: {
      title: '首页',
      icon: ''
    },
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          title: '首页',
          icon: 'home'
        }
      }
    ]
  },
  {
    path: '/login',
    name: '登录',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录',
      hidden: true
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error-page/404.vue'),
    meta: {
      title: '404',
      hidden: true
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
